home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / CSUBR.LZH / DATAIN.C < prev    next >
Text File  |  1985-11-17  |  788b  |  43 lines

  1. int datain()
  2. {
  3.     int nc, c, kbdin();
  4.     unsigned i;
  5.  
  6.     if (IFd != -1) {
  7.         if ((c = kbdin()) == CMND) {
  8.             conout("\nFile Abort from Console \n",NORM);
  9.             fclose(IFd);
  10.             IFd = -1;
  11.             getchar();
  12.             return(c);
  13.         }
  14.         if ((c = getc(IFd)) == EOF) {
  15.             conout("\nEnd of File on ",NORM);
  16.             conout(Infile,NORM);
  17.             fclose(IFd);
  18.             IFd = -1;
  19.             return(kbdin());
  20.         }
  21.         else {
  22.             if (TrmMd) {
  23.                 if (c == SIMCTRL) {
  24.                     if ((nc = getc(IFd)) == EOF) {
  25.                         conout("\nPremature End of File on ",NORM);
  26.                         conout(Infile,NORM);
  27.                         fclose(IFd);
  28.                         IFd = -1;
  29.                         return(kbdin());
  30.                     }
  31.                     if (nc != c)
  32.                         c = 0xbf & nc;    /* convert to control character */
  33.                 }
  34.                 for (i=0; i <10000; i++) ;
  35.             }
  36.             return(c);
  37.         }
  38.     }
  39.     else
  40.         return(kbdin());
  41. }
  42.  
  43.